# Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: dibblethewrecker dibblethewrecker.at.jiwe.dot.org
# Contributor: William Rea <sillywilly@gmail.com>

pkgname=postgis
pkgver=3.3.2
pkgrel=2
pkgdesc="A spatial database extender for PostgreSQL"
arch=(loong64 x86_64)
url="https://postgis.net/"
license=(GPL)
depends=(postgresql gdal geos json-c libxml2 proj protobuf-c pcre2)
optdepends=('perl: for contrib script postgis_restore.pl')
makedepends=(clang llvm)
changelog=$pkgname.changelog
source=(https://download.osgeo.org/postgis/source/${pkgname}-${pkgver}.tar.gz)
sha256sums=('9a2a219da005a1730a39d1959a1c7cec619b1efb009b65be80ffc25bad299068')
b2sums=('40dc7636f04e0d5cfd734b175da1ce49c32e4b8f5750059e79e03a7395fb8b9241c1f479815794b46dee81704d7c392fe7693c9f0180323d1ca21812c37d36b5')

prepare() {
  cd ${pkgname}-${pkgver}
  autoreconf -vfi
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
}
